BACKEND = 'cuda'
IS_SUBSET = False
NUM_SUBSET = 64 * 2
DATA_PATH = r"/mnt/personal-phd/data/PseudoLabel/webvision/"
import time
class TimeUse:
    def __init__(self, name="", measure = "s") -> None:
        self.t = -1
        self.name = name
        self.measure = measure
        assert self.measure in ['s', 'm', 'h']

    def __enter__(self):
        self.t = time.time()
        print("{} Start.".format(self.name))

    def __exit__(self, exc_type, exc_value, exc_tb):
        if self.measure == "s":
            self.use_time = (time.time() - self.t)
        if self.measure == "m":
            self.use_time = (time.time() - self.t) / 60
        if self.measure == "h":
            self.use_time = (time.time() - self.t) / 60 / 60
        
        print("{} Ends, using {} {}".format(self.name, self.use_time, self.measure))
    